Skip to content

Nice shutdown#63

Open
masicek wants to merge 2 commits into
masterfrom
nice-shutdown
Open

Nice shutdown#63
masicek wants to merge 2 commits into
masterfrom
nice-shutdown

Conversation

@masicek

@masicek masicek commented Jun 23, 2026

Copy link
Copy Markdown
Contributor
  • Add SHUTDOWN control message and NICE_SHUTDOWN_EXIT_CODE (100) to PhpAmqpLib producer
  • Implement publishShutdown() method on Producer interface for targeted graceful consumer stops
  • Update PhpAmqpLib consumer to recognize SHUTDOWN message and exit with code 100 instead of restarting
  • Add background-queue:shutdown-consumers command with same targeting as reload-consumers (number, queue, -l label)
  • Add comprehensive test suite including end-to-end subprocess test verifying proper exit code
  • Add shutdownConsumerWorker.php fixture for subprocess testing against real RabbitMQ and database
  • Document nice shutdown mechanism in README with supervisor configuration example (exitcodes=100, autorestart=unexpected)
  • Update CLAUDE.md with details on dual control messages (DIE for restart, SHUTDOWN for graceful stop)
  • Update all Producer implementations and test mocks to support publishShutdown method

This allows supervisor-managed consumers to be gracefully stopped before server maintenance or restarts
without requiring restarts, while maintaining backward compatibility with existing reload-consumers workflow.

Viktor Mašíček added 2 commits June 23, 2026 10:54
- Add Manager methods getTopPriorityName() and includeTopPriority() to support per-label DIE queues (e.g., 0_worker)
- Update Consumer and Producer interfaces to accept optional consumerLabel parameter
- Add -l/--label option to consume and reload-consumers commands
- Enhance reload-consumers to send DIE per label with -l option (e.g., -l label1,label2) while maintaining backward compatibility (number of DIE messages per label/queue)
- Update Producer helper signatures to match interface changes
- Add comprehensive unit and integration tests for label queue naming and reload logic
- Update README and CLAUDE.md with new functionality and usage guidance
- Add SHUTDOWN control message and NICE_SHUTDOWN_EXIT_CODE (100) to PhpAmqpLib producer
- Implement publishShutdown() method on Producer interface for targeted graceful consumer stops
- Update PhpAmqpLib consumer to recognize SHUTDOWN message and exit with code 100 instead of restarting
- Add background-queue:shutdown-consumers command with same targeting as reload-consumers (number, queue, -l label)
- Add comprehensive test suite including end-to-end subprocess test verifying proper exit code
- Add shutdownConsumerWorker.php fixture for subprocess testing against real RabbitMQ and database
- Document nice shutdown mechanism in README with supervisor configuration example (exitcodes=100, autorestart=unexpected)
- Update CLAUDE.md with details on dual control messages (DIE for restart, SHUTDOWN for graceful stop)
- Update all Producer implementations and test mocks to support publishShutdown method

This allows supervisor-managed consumers to be gracefully stopped before server maintenance or restarts
without requiring restarts, while maintaining backward compatibility with existing reload-consumers workflow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant